#ifndef __FMUX_H
#define __FMUX_H

#include <stdint.h>

// commands
// ? cant find a ieee mac of cc2420
#define OTPLATRADIOGETIEEEEUI64						0
//  P. 41
// (uint16_t)
#define OTPLATRADIOSETPANID							1
// ye, in ram
// (uint8_t)[8]
#define OTPLATRADIOSETEXTENDEDADDRESS				2
// ye, in ram
// (uint16_t)
#define OTPLATRADIOSETSHORTADDRESS					3
// just return the radio state
// 0
#define OTPLATRADIOGETSTATE							4
// enable radio
// 0
#define OTPLATRADIOENABLE							5
// disable radio
// 0
#define OTPLATRADIODISABLE							6
// via getstate
// not implemented
#define OTPLATRADIOISENABLED						7
// sleep radio
// 0
#define OTPLATRADIOSLEEP							8
// start receiving on channel given
// (uint8_t)
#define OTPLATRADIORECEIVE							9
// some reg
// (uint8_t)
#define OTPLATRADIOENABLESRCMATCH					10
// should be done server side
// (uint16_t)
#define OTPLATRADIOADDSRCMATCHSHORTENTRY			11
// should be done server side
// (uint8_t)[8]
#define OTPLATRADIOADDSRCMATCHEXTENTRY				12
// should be done server side
// (uint16_t)
#define OTPLATRADIOCLEARSRCMATCHSHORTENTRY			13
// should be done server side
// (uint8_t)[8]
#define OTPLATRADIOCLEARSRCMATCHEXTENTRY			14
// should be done server side
// 0
#define OTPLATRADIOCLEARSRCMATCHSHORTENTRIES		15
// should be done server side
// 0
#define OTPLATRADIOCLEARSRCMATCHEXTENTRIES			16
// forms the PSDU buffer server side?
// not implemented
#define OTPLATRADIOGETTRANSMITBUFFER				17
// sends the PSDU, also has channel and power info
//  need to do this differently, i.e. send channel
//  and psdu separately
// not implemented
#define OTPLATRADIOTRANSMIT							18
// get RSSI measurement
// 0
// expect: (uint8_t)
#define OTPLATRADIOGETRSSI							19
// fill struct
// not implemented
#define OTPLATRADIOGETCAPS							20
// get transmit power
// not implemented (yet)
#define OTPLATRADIOGETTRANSMITPOWER					21
// set transmit power
// not implemented (yet)
#define OTPLATRADIOSETTRANSMITPOWER					22
// yada
// 0
// expect (uint8_t)
#define OTPLATRADIOGETPROMISCUOUS					23
// yada (0 or 1)
// (uint8_t)
#define OTPLATRADIOSETPROMISCUOUS					24
// yada
// not implemented (yet)
#define OTPLATRADIOENERGYSCAN						25
// yada
// gotta figure that out (but not important for now)
#define OTPLATRADIOGETRECEIVESENSITIVITY			26
// poll for new frames
// 0
// expect: (uint8_t)[127]
#define RADIOPOLLFRAME                              27
// set channel to transmit
// (uint8_t)
#define RADIOSETCHANNEL                             28
// set the PSDU len
// (uint8_t)
#define RADIOSETPSDULEN                             29
// set the PSDU
// (uint8_t)[127-2]
#define RADIOSETPSDU                                30

// events
// self explainatory
#define OTPLATRADIORECEIVEDONE						128
// same
#define OTPLATRADIOTXSTARTED						129
// same
#define OTPLATRADIOTXDONE							130
// no need
#define OTPLATDIAGRADIOTRANSMITDONE					131
// no need
#define OTPLATDIAGRADIORECEIVEDONE					132
// same
#define OTPLATRADIOENERGYSCANDONE					133

struct comm_unit {
	uint8_t size;
	uint8_t cmd;
	uint8_t data[];
};

#endif //__FMUX_H
